﻿using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using XinLife.Application.Interface;
using XinLife.Core.Model;
using XinLife.Model.Busines;

namespace XinLife.Controllers.Business
{
    /// <summary>
    /// 黑名单人员管理
    /// </summary>
    public class BlacklistController : BaseController
    {
        private readonly IBlacklistService _blacklistService;
        public BlacklistController(IBlacklistService blacklistService)
        {
            _blacklistService = blacklistService;
        }

        /// <summary>
        /// 获取列表
        /// </summary>
        [HttpGet]
        public async Task<object> GetBlacklistPageList([FromQuery] Pagination pagination, [FromQuery] string queryJson = null)
        {
            return await _blacklistService.GetBlacklistPageList(pagination, queryJson);
        }
        /// <summary>
        /// 获取表单信息
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<AjaxResult> GetBlacklistForm(string id)
        {
            return await _blacklistService.GetBlacklistForm(id);
        }
        /// <summary>
        /// 编辑
        /// </summary>-
        /// <returns></returns>
        [HttpPost]
        public async Task<AjaxResult> EditBlacklist([FromForm] Blacklist blacklist)
        {
            return await _blacklistService.EditBlacklist(blacklist);
        }
        /// <summary>
        /// 删除
        /// </summary>
        [HttpPost]
        public async Task<AjaxResult> DelBlacklist([FromForm] string ids)
        {
            return await _blacklistService.DelBlacklist(ids);
        }
        [HttpPost]
        public async Task<AjaxResult> SetInvalid([FromForm] string cId)
        {
            return await _blacklistService.SetInvalid(cId);
        }

    }
}
